import requests
import pytest
base_url = 'http://39.107.96.138:3000/api/v1'
token1 = 'a4742157-a8cf-4875-9561-1856400ed55a'
token2 = '7e70fd53-8e1c-4b25-a963-68a0eff28e1b'
json_data = {
        "accesstoken": token1,
        "title": "2311111111111111",
        "tab": "ask",
        "content": "assss"
    }

def create_new_topic(json_data=json_data):
    url = f'{base_url}/topics'

    return requests.post(url,json=json_data)

def create_new_reply(topic_id):
    url = f'{base_url}/topic/{topic_id}/replies'
    reply_data = {
        "accesstoken":token2,
        "content":'xxxxxxxxxxxx'
    }
    return requests.post(url,json=reply_data)

def get_user_info(loginname):
    url = f'{base_url}/user/{loginname}'
    return requests.get(url)

def get_topic_index(data):
    url = f'{base_url}/topics'
    return requests.get(url=url,params=data)

def eidt_topic(topic_data):
    url = f'{base_url}/topics/update'
    return requests.post(url,json=topic_data)

def get_topic_detail(topic_id):
    url = f'{base_url}/topic/{topic_id}'
    return requests.get(url)